<?php 
	namespace Admin\Controller;
	use Think\Controller;
	//后台登录控制器
	class SystemController extends Controller{
		//关键字过滤视图
		public function filter(){
			//键名区分大小写
			$config=include './application/common/conf/system.php';
			//把filter配置项数组转换为字符串，用|隔开
			$this->filter=implode('|',$config['FILTER']);
			$this->display();
		}
		/**
		 * 执行修改关键词
		 */
		Public function runEditFilter () {
			$path = './application/common/conf/system.php';
			$config = include $path;
			//解析客户端传来的字符串
			$config['FILTER'] = explode('|', $_POST['filter']);
			//把config转换为字符串，写入这个文件
			$data = "<?php\nreturn " . var_export($config) . ";\n?>";
			if (file_put_contents($path, $data)) {
				$this->success('修改成功', U('filter'));
			} else {
				$this->error('修改失败， 请修改' . $path . '的写入权限');
			}
		}	
	}
 ?>